import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'state.dart';

class HomeLogic extends GetxController with GetSingleTickerProviderStateMixin {
  final HomeState state = HomeState();

  late TabController tabController;

  late PageController pageController;

  @override
  void onInit() {
    super.onInit();
    tabController =
        TabController(length: state.todayTabList.length, vsync: this);
    pageController = PageController();
  }

  void changTab(int index) {
    pageController.animateToPage(index,
        duration: const Duration(milliseconds: 300), curve: Curves.ease);
  }

  void changPage(int index) {
    tabController.animateTo(index, duration: const Duration(milliseconds: 300));
  }
}
